﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace SpLocalizer.Common
{
    /// <summary>
    /// Content to translate
    /// </summary>
    public abstract class AbstractContent : ProjectEntity
    {
     
        #region Properties

        private Guid _Id = Guid.NewGuid();
        public Guid Id {
            get { return _Id; }
            set {this._Id = value;} 
        }
        

        /// <summary>
        /// Identity for current content
        /// </summary>
        public string ContentId { get; set; }


        private string _ParentContentId = null;
        /// <summary>
        /// Parent content id
        /// </summary>        
        public string ParentContentId { 
            get {return _ParentContentId;} 
            set {this._ParentContentId = value;}
        }

        /// <summary>
        /// Address for current content
        /// </summary>
        public string ContentAddress { get; set; }
             
        /// <summary>
        /// 
        /// </summary>
        public string ContentTitle { get; set; }

        private  bool _IncludeDescendants = false;
        /// <summary>
        /// Include descendants content sources
        /// </summary>        
        public bool IncludeDescendants { 
            get {   return this._IncludeDescendants;    }
            set {   this._IncludeDescendants = value;   }
        }

        /// <summary>
        /// Return the task type 
        /// </summary>
        public virtual string ContentProviderName
        {
            get
            {
                return this.GetType().Name;
            }
        }
 
        #endregion

        /// <summary>
        /// Return content translation tasks for this content source
        /// </summary>
        /// <returns></returns>
        public abstract IEnumerable<BaseTranslationTask> BuildTranslationTasks(CultureInfo FromLanguage, CultureInfo ToLanguage);

        /// <summary>
        /// Export translations back into content source
        /// </summary>
        /// <param name="TranslationTask"></param>
        public abstract void ExportContentTranslations(BaseTranslationTask TranslationTask);

        /// <summary>
        /// This method called when all export tasks are exported (export done)
        /// </summary>
        public abstract void PerformExportDone();
    }

    /* Don't need this
    /// <summary>
    /// Status of translation task
    /// </summary>
    public enum ContentStatus
    {
        Empty = 0,
        Initialized = 1,
        WaitForTranslation = 2,
        TranslationInProcess = 3,      
        Translated = 6,
        WaitForExport = 7,
        ExportInProgress = 8,
        ExportErrorRetry = 9,
        ExportErrorFatal = 10,
        Exported = 11,
        Compleated = 100
    }*/
}
